<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <title>看帖</title>
</head>
<style>
    /* 页面布局 */
    body{
        padding-bottom:80px;
    }
    .allPosts{
        height: 70%;
        margin-left: 2px;
        margin-right: 2px;
        /*overflow: scroll; */
    }
    .footer{
        width: 100%;
        text-align: center;
        position: fixed;
        bottom: 0;
        background-color:rgba(197, 227, 236, 0.808);
        border-radius: 8px;
    }
    /* 回复表单 */
    .footer>form{
        height: 80px;
    }
    #reply-text{
        margin-top: 5px;
        width: 60%;
        height: 70px;
        border-radius: 8px;
    }
    #reply-button{
        width: 10%;
        height: 70px;
        border-radius: 8px;
    }

    /* 单个帖子设计 */
    .post{
        /* margin-top: 2px; */
        width: 100%;
        height: 300px;
        border: #bdbdbd solid 2px;
        border-radius: 8px;
        background-color:whitesmoke
    }
    .v{
        width: inherit;
        height: inherit;
    }
    .part-1{
        width: 100%;
        height: 15%;
    }
    .userHead{
        float: left;
        text-align: center;
        width: 10%;
    }
    .user{
        float: left;
        width: 80%;
        height: 100%;

    }
    .record-button{
        float: left;
        width: 8%;
    }
    .record-button>button{
        margin-top: 3px;
        margin-left: 8px;
        width: 100%;
        border: gainsboro solid 2px;
        border-radius: 8px;
    }
    .part-2{
        width: 100%;
        height: 10%;
    }
    .post-title{
        float: left;
        font-weight: bold;
    }
    .part-3{
        width: 100%;
        height: 70%;
    }
    .post-text{
        width: 100%;
        height: 100%;
        float: left;
        font-size: 16px;
        overflow: scroll;
    }
    .seg{
        width: 100%;
        height: 1px;
        background-color: #bdbdbd;
    }

</style>
<body>
<!-- 全部帖子 -->
<div class="allPosts">
    <!-- 每个帖子 -->
    <div class="post" id="show">
        <div v-for="text in allText" class="v">
            <div class="part-1">
                <div class="userHead">
                    <img src="https://gitee.com/konjac_wjh/pig-go/raw/master/img/user.png" alt="userHead" style="width: 39px;">
                </div>
                <div class="user">
                    <p>{{text.poster}}</p>
                </div>
                <div class="record-button">
                    <button type="submit" name="reply-post" class="btn btn-info">@</button>
                </div>
            </div>
            <div class="seg"></div>
            <div class="part-2">
                <div class="post-title">
                    <p>{{text.title}}</p>
                </div>
            </div>
            <div class="seg"></div>
            <div class="part-3">
                <div class="post-text" text-justify pre-scrollable>
                    <p>{{text.text}}</p>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="footer">
    <form action="#">
        <input id="reply-text" type="text" placeholder="留下精彩的回复">
        <input id="reply-button" type="button" value="回复" class="btn btn-info">
    </form>
</div>
</body>

<script src="../js/axios-min.js"></script>
<script src="../js/vue.js"></script>
<script>

    new Vue({
        el: "#show",
        data() {
            return {
                allText: []
            }
        },
        mounted() {
            //页面加载完成，发送axios的异步请求
            var _this = this;
            axios({
                method: "post",
                url: "../Text/sats"
            }).then(function (resp) {
                _this.allText = resp.data;
            })
        }
    })

</script>
</html>